// $ANTLR 3.4 /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g 2011-12-13 09:34:35
 
	package ar.uba.tleng.g99.expregs.parser;
	import ar.uba.tleng.g99.expregs.automata.*; 


import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;

@SuppressWarnings({"all", "warnings", "unchecked"})
public class GramaticaParser extends Parser {
    public static final String[] tokenNames = new String[] {
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "ASTERISK", "CHAR", "PLUS", "QUESTION", "'('", "')'", "'*'", "'+'", "'.'", "'?'", "'|'"
    };

    public static final int EOF=-1;
    public static final int T__8=8;
    public static final int T__9=9;
    public static final int T__10=10;
    public static final int T__11=11;
    public static final int T__12=12;
    public static final int T__13=13;
    public static final int T__14=14;
    public static final int ASTERISK=4;
    public static final int CHAR=5;
    public static final int PLUS=6;
    public static final int QUESTION=7;

    // delegates
    public Parser[] getDelegates() {
        return new Parser[] {};
    }

    // delegators


    public GramaticaParser(TokenStream input) {
        this(input, new RecognizerSharedState());
    }
    public GramaticaParser(TokenStream input, RecognizerSharedState state) {
        super(input, state);
    }

    public String[] getTokenNames() { return GramaticaParser.tokenNames; }
    public String getGrammarFileName() { return "/home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g"; }



    // $ANTLR start "s"
    // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:17:1: s returns [Expr e] : expr ;
    public final Expr s() throws RecognitionException {
        Expr e = null;


        Expr expr1 =null;


        try {
            // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:18:2: ( expr )
            // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:18:4: expr
            {
            pushFollow(FOLLOW_expr_in_s54);
            expr1=expr();

            state._fsp--;


            e = expr1;

            }

        }
         
        finally {
        	// do for sure before leaving
        }
        return e;
    }
    // $ANTLR end "s"



    // $ANTLR start "lambda"
    // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:20:1: lambda returns [Expr e] :;
    public final Expr lambda() throws RecognitionException {
        Expr e = null;


        try {
            // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:21:2: ()
            // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:21:4: 
            {
            e = null;

            }

        }
        finally {
        	// do for sure before leaving
        }
        return e;
    }
    // $ANTLR end "lambda"



    // $ANTLR start "expr"
    // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:23:1: expr returns [Expr e] : orExpr endExpr ;
    public final Expr expr() throws RecognitionException {
        Expr e = null;


        Expr endExpr2 =null;

        Expr orExpr3 =null;


        try {
            // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:24:2: ( orExpr endExpr )
            // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:24:4: orExpr endExpr
            {
            pushFollow(FOLLOW_orExpr_in_expr83);
            orExpr3=orExpr();

            state._fsp--;


            pushFollow(FOLLOW_endExpr_in_expr85);
            endExpr2=endExpr();

            state._fsp--;



            			if (endExpr2 == null) {
            				e = orExpr3;
            			} else {
            				e = new OrExpr(orExpr3, endExpr2);
            			}
            		

            }

        }
         
        finally {
        	// do for sure before leaving
        }
        return e;
    }
    // $ANTLR end "expr"



    // $ANTLR start "endExpr"
    // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:33:1: endExpr returns [Expr e] : (| '|' expr );
    public final Expr endExpr() throws RecognitionException {
        Expr e = null;


        Expr expr4 =null;


        try {
            // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:34:2: (| '|' expr )
            int alt1=2;
            int LA1_0 = input.LA(1);

            if ( (LA1_0==EOF||LA1_0==9) ) {
                alt1=1;
            }
            else if ( (LA1_0==14) ) {
                alt1=2;
            }
            else {
                NoViableAltException nvae =
                    new NoViableAltException("", 1, 0, input);

                throw nvae;

            }
            switch (alt1) {
                case 1 :
                    // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:34:4: 
                    {
                    e = null;

                    }
                    break;
                case 2 :
                    // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:34:18: '|' expr
                    {
                    match(input,14,FOLLOW_14_in_endExpr109); 

                    pushFollow(FOLLOW_expr_in_endExpr111);
                    expr4=expr();

                    state._fsp--;


                    e = expr4;

                    }
                    break;

            }
        }
         
        finally {
        	// do for sure before leaving
        }
        return e;
    }
    // $ANTLR end "endExpr"



    // $ANTLR start "orExpr"
    // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:36:1: orExpr returns [Expr e] : concatExpr endOrExpr ;
    public final Expr orExpr() throws RecognitionException {
        Expr e = null;


        Expr endOrExpr5 =null;

        Expr concatExpr6 =null;


        try {
            // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:37:2: ( concatExpr endOrExpr )
            // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:37:4: concatExpr endOrExpr
            {
            pushFollow(FOLLOW_concatExpr_in_orExpr127);
            concatExpr6=concatExpr();

            state._fsp--;


            pushFollow(FOLLOW_endOrExpr_in_orExpr129);
            endOrExpr5=endOrExpr();

            state._fsp--;



            			if (endOrExpr5 == null) {
            				e = concatExpr6;
            			} else {
            				e = new ConcatExpr(concatExpr6, endOrExpr5);
            			}
            		

            }

        }
         
        finally {
        	// do for sure before leaving
        }
        return e;
    }
    // $ANTLR end "orExpr"



    // $ANTLR start "endOrExpr"
    // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:46:1: endOrExpr returns [Expr e] : ( lambda | orExpr );
    public final Expr endOrExpr() throws RecognitionException {
        Expr e = null;


        Expr orExpr7 =null;


        try {
            // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:47:2: ( lambda | orExpr )
            int alt2=2;
            int LA2_0 = input.LA(1);

            if ( (LA2_0==EOF||LA2_0==9||LA2_0==14) ) {
                alt2=1;
            }
            else if ( (LA2_0==CHAR||LA2_0==8||LA2_0==12) ) {
                alt2=2;
            }
            else {
                NoViableAltException nvae =
                    new NoViableAltException("", 2, 0, input);

                throw nvae;

            }
            switch (alt2) {
                case 1 :
                    // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:47:4: lambda
                    {
                    pushFollow(FOLLOW_lambda_in_endOrExpr147);
                    lambda();

                    state._fsp--;


                    e = null;

                    }
                    break;
                case 2 :
                    // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:47:25: orExpr
                    {
                    pushFollow(FOLLOW_orExpr_in_endOrExpr153);
                    orExpr7=orExpr();

                    state._fsp--;


                    e = orExpr7;

                    }
                    break;

            }
        }
         
        finally {
        	// do for sure before leaving
        }
        return e;
    }
    // $ANTLR end "endOrExpr"



    // $ANTLR start "concatExpr"
    // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:49:1: concatExpr returns [Expr e] : atomExpr endConcatExpr ;
    public final Expr concatExpr() throws RecognitionException {
        Expr e = null;


        Integer endConcatExpr8 =null;

        Expr atomExpr9 =null;


        try {
            // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:50:2: ( atomExpr endConcatExpr )
            // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:50:4: atomExpr endConcatExpr
            {
            pushFollow(FOLLOW_atomExpr_in_concatExpr168);
            atomExpr9=atomExpr();

            state._fsp--;


            pushFollow(FOLLOW_endConcatExpr_in_concatExpr170);
            endConcatExpr8=endConcatExpr();

            state._fsp--;



            			if (endConcatExpr8 == null) {
            				e = atomExpr9;
            			} else if (endConcatExpr8 == PLUS) {
            				e = new PlusExpr(atomExpr9);
            			} else if (endConcatExpr8 == ASTERISK) {
            				e = new AsteriskExpr(atomExpr9);
            			} else if (endConcatExpr8 == QUESTION) {
            				e = new QuestionExpr(atomExpr9);
            			}
            		

            }

        }
         
        finally {
        	// do for sure before leaving
        }
        return e;
    }
    // $ANTLR end "concatExpr"



    // $ANTLR start "endConcatExpr"
    // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:64:1: endConcatExpr returns [Integer t] : ( lambda | '?' e= endConcatExpr | '*' e= endConcatExpr | '+' e= endConcatExpr );
    public final Integer endConcatExpr() throws RecognitionException {
        Integer t = null;


        Integer e =null;


        try {
            // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:65:2: ( lambda | '?' e= endConcatExpr | '*' e= endConcatExpr | '+' e= endConcatExpr )
            int alt3=4;
            switch ( input.LA(1) ) {
            case EOF:
            case CHAR:
            case 8:
            case 9:
            case 12:
            case 14:
                {
                alt3=1;
                }
                break;
            case 13:
                {
                alt3=2;
                }
                break;
            case 10:
                {
                alt3=3;
                }
                break;
            case 11:
                {
                alt3=4;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 3, 0, input);

                throw nvae;

            }

            switch (alt3) {
                case 1 :
                    // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:65:5: lambda
                    {
                    pushFollow(FOLLOW_lambda_in_endConcatExpr191);
                    lambda();

                    state._fsp--;


                    t = null;

                    }
                    break;
                case 2 :
                    // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:66:4: '?' e= endConcatExpr
                    {
                    match(input,13,FOLLOW_13_in_endConcatExpr198); 

                    pushFollow(FOLLOW_endConcatExpr_in_endConcatExpr202);
                    e=endConcatExpr();

                    state._fsp--;



                    		if (e == null || e == QUESTION) {
                    			t = QUESTION;
                    		} else {
                    			t = ASTERISK;
                    		}
                    	

                    }
                    break;
                case 3 :
                    // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:74:4: '*' e= endConcatExpr
                    {
                    match(input,10,FOLLOW_10_in_endConcatExpr211); 

                    pushFollow(FOLLOW_endConcatExpr_in_endConcatExpr215);
                    e=endConcatExpr();

                    state._fsp--;


                    t = ASTERISK;

                    }
                    break;
                case 4 :
                    // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:76:4: '+' e= endConcatExpr
                    {
                    match(input,11,FOLLOW_11_in_endConcatExpr224); 

                    pushFollow(FOLLOW_endConcatExpr_in_endConcatExpr228);
                    e=endConcatExpr();

                    state._fsp--;



                    		if (e == null || e == PLUS) {
                    			t = PLUS;
                    		} else {
                    			t = ASTERISK;
                    		}
                    	

                    }
                    break;

            }
        }
         
        finally {
        	// do for sure before leaving
        }
        return t;
    }
    // $ANTLR end "endConcatExpr"



    // $ANTLR start "atomExpr"
    // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:84:1: atomExpr returns [Expr e] : ( CHAR | '.' | '(' expr ')' );
    public final Expr atomExpr() throws RecognitionException {
        Expr e = null;


        Token CHAR10=null;
        Expr expr11 =null;


        try {
            // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:85:2: ( CHAR | '.' | '(' expr ')' )
            int alt4=3;
            switch ( input.LA(1) ) {
            case CHAR:
                {
                alt4=1;
                }
                break;
            case 12:
                {
                alt4=2;
                }
                break;
            case 8:
                {
                alt4=3;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 4, 0, input);

                throw nvae;

            }

            switch (alt4) {
                case 1 :
                    // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:85:4: CHAR
                    {
                    CHAR10=(Token)match(input,CHAR,FOLLOW_CHAR_in_atomExpr243); 

                     e = new AtomExpr(CHAR10.getText().charAt(0)); 

                    }
                    break;
                case 2 :
                    // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:86:4: '.'
                    {
                    match(input,12,FOLLOW_12_in_atomExpr251); 

                     e = new AtomExpr('.'); 

                    }
                    break;
                case 3 :
                    // /home/pasto/Documents/Facultad/tleng/workspace/expregs/scripts/../data/Gramatica.g:87:4: '(' expr ')'
                    {
                    match(input,8,FOLLOW_8_in_atomExpr259); 

                    pushFollow(FOLLOW_expr_in_atomExpr261);
                    expr11=expr();

                    state._fsp--;


                    match(input,9,FOLLOW_9_in_atomExpr263); 

                     e = expr11; 

                    }
                    break;

            }
        }
         
        finally {
        	// do for sure before leaving
        }
        return e;
    }
    // $ANTLR end "atomExpr"

    // Delegated rules


 

    public static final BitSet FOLLOW_expr_in_s54 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_orExpr_in_expr83 = new BitSet(new long[]{0x0000000000004000L});
    public static final BitSet FOLLOW_endExpr_in_expr85 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_14_in_endExpr109 = new BitSet(new long[]{0x0000000000001120L});
    public static final BitSet FOLLOW_expr_in_endExpr111 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_concatExpr_in_orExpr127 = new BitSet(new long[]{0x0000000000001120L});
    public static final BitSet FOLLOW_endOrExpr_in_orExpr129 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_lambda_in_endOrExpr147 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_orExpr_in_endOrExpr153 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_atomExpr_in_concatExpr168 = new BitSet(new long[]{0x0000000000002C00L});
    public static final BitSet FOLLOW_endConcatExpr_in_concatExpr170 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_lambda_in_endConcatExpr191 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_13_in_endConcatExpr198 = new BitSet(new long[]{0x0000000000002C00L});
    public static final BitSet FOLLOW_endConcatExpr_in_endConcatExpr202 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_10_in_endConcatExpr211 = new BitSet(new long[]{0x0000000000002C00L});
    public static final BitSet FOLLOW_endConcatExpr_in_endConcatExpr215 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_11_in_endConcatExpr224 = new BitSet(new long[]{0x0000000000002C00L});
    public static final BitSet FOLLOW_endConcatExpr_in_endConcatExpr228 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_CHAR_in_atomExpr243 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_12_in_atomExpr251 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_8_in_atomExpr259 = new BitSet(new long[]{0x0000000000001120L});
    public static final BitSet FOLLOW_expr_in_atomExpr261 = new BitSet(new long[]{0x0000000000000200L});
    public static final BitSet FOLLOW_9_in_atomExpr263 = new BitSet(new long[]{0x0000000000000002L});

}